#ifndef _WINDOW_H_
#define _WINDOW_H_

#include "BuzzGlobals.h"
#include "Keyboard.h"

///
// Window - A window. Nothing more to say really.
///
class Window {
public:
	Window(int resX, int resY, const char* windowTitle = NULL, int globalScale = 1);
	~Window();

	void process();

	/// Singleton accessor
	static Window* getInstance();

    /// Sets the title/caption on the window
	void setTitle(const char* title){ SDL_WM_SetCaption(title, NULL); }

	/// Returns the width of the window (not taking into account global scale)
	int getWidth() { return resX; }
	
	/// Returns the height of the window (not taking into account global scale)
	int getHeight() { return resY; }

	/// Sets the default background colour of the window
    void setBackgroundColour(Uint8 r, Uint8, Uint8 b);

	/// True while the window is open. False when it is closed by the user
	bool isOpen(){ return running; }

protected:
	void doEvents();
	void doFrame();

	int resX, resY;
	SDL_Surface* surface;

	static Window* instance;

	bool running;
};
#endif
